// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// This file is part of CodingEditor.
// Note:	This project is derived from Peter Project
//			(hosted on sourceforge and codeplex)
//
// Copyright (c) 2008-2009, CE Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


namespace CE.Main
{
	using System.ComponentModel;
	using System.Drawing;
	using System.Windows.Forms;

	using CE.API;

	using WeifenLuo.WinFormsUI.Docking;

	public sealed partial class FindResults : DockContent, ICEPluginTab
	{
		#region Fields

		private ICEPluginHost m_Host;

		#endregion Fields

		#region Constructors

		public FindResults()
		{
			InitializeComponent();
			//System.Resources.ResourceManager mngr = new System.Resources.ResourceManager("CE.InternalImages", this.GetType().Assembly);
			//this.imgMain.Images.Add("Next", (Image)mngr.GetObject("Next"));
			this.TabText = "Find Results";
		}

		#endregion Constructors

		#region Properties

		public bool AbleToCopy
		{
			get { return true; }
		}

		public bool AbleToCut
		{
			get { return false; }
		}

		public bool AbleToDelete
		{
			get { return true; }
		}

		public bool AbleToPaste
		{
			get { return false; }
		}

		public bool AbleToRedo
		{
			get { return false; }
		}

		public bool AbleToSave
		{
			get { return false; }
		}

		public bool AbleToSelectAll
		{
			get { return false; }
		}

		public bool AbleToUndo
		{
			get { return false; }
		}

		public string FileName
		{
			get { return ""; }
		}

		public ICEPluginHost Host
		{
			get { return this.m_Host; }

			set { this.m_Host = value; }
		}

		/// <summary>
		/// Gets or Sets the Image List...
		/// </summary>
		public ImageList Images
		{
			get { return this.imgMain; }

			set { this.imgMain = value; }
		}

		public bool NeedsSaving
		{
			get { return false; }
		}

		public string Selection
		{
			get { return ""; }
		}

		/// <summary>
		/// Gets or Sets the Tree View...
		/// </summary>
		public TreeView Tree
		{
			get { return this.treeMain; }

			set { this.treeMain = value; }
		}

		#endregion Properties

		#region Methods

		public bool CloseTab()
		{
			this.Hide();
			return true;
		}

		public void Copy()
		{
			if (this.treeMain.SelectedNode != null) {
				Clipboard.SetText(this.treeMain.SelectedNode.Text);
			}
		}

		public void Cut()
		{
		}

		public void Delete()
		{
			if (this.treeMain.SelectedNode != null) {
				if (this.treeMain.SelectedNode.Parent == null) {
					this.treeMain.Nodes.Remove(this.treeMain.SelectedNode);
				} else {
					this.treeMain.SelectedNode.Parent.Nodes.Remove(this.treeMain.SelectedNode);
				}
			}
		}

		public void Duplicate()
		{
		}

		public bool FindNext( System.Text.RegularExpressions.Regex reg, bool searchUp)
		{
			return false;
		}

		public void MarkAll( System.Text.RegularExpressions.Regex reg)
		{
		}

		public void Paste()
		{
		}

		public void Print(bool showDialog)
		{
		}

		public void Redo()
		{
		}

		public void ReplaceAll( System.Text.RegularExpressions.Regex reg,   string replaceWith)
		{
		}

		public void ReplaceNext( System.Text.RegularExpressions.Regex reg,
		                         string replaceWith, bool searchUp)
		{
		}

		public void Save()
		{
		}

		public void SaveAs( string filePath)
		{
		}

		public void SelectAll()
		{
		}

		public void SelectWord(int line, int offset, int wordLeng)
		{
		}

		public void Undo()
		{
		}

		/// <summary>
		/// Overrides the Close Action...
		/// </summary>
		/// <param name="e">Cancel Events.</param>
		protected override void OnClosing(CancelEventArgs e)
		{
			e.Cancel = true;
			this.Hide();
			base.OnClosing(e);
		}

		private void FindResults_FormClosed(object sender, FormClosedEventArgs e)
		{
			this.Dispose(true);
		}

		#endregion Methods
	}
}